<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>闭包的应用</h1>

<script>
    let module =(function(){
        let a = 10;
        let b = 7;
        function add(){
            return a+b;
        }

        function sub(){
            return a-b;
        }

        function multi(){
            return a*b;
        }

        function div(){
            return a/b;
        }

        return{
            add: add,
            sub: sub,
            multi: multi,
            div :div
        }
    })();

    console.log(module.add());
    console.log(module.sub());
    console.log(module.multi())
    console.log(module.div());

</script>
</body>
</html>